<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p>父：</p>
        <span>money:{{fromSon.money}}</span>
        <span>love:{{fromSon.love}}</span>
        <p>子：</p>
        <son @shou="mySon"></son>
    </div>
    <template id="son">
        <div>
            <button @click="tofa">给爸</button>
        </div>
    </template>
    <script src="../vue.js"></script>
    <script>
        let son={
            template:'#son',
            data () {
                return {
                    liwu:{
                        money:"lots",
                        love:'infinite'
                    }
                }
            },
            methods: {
                tofa(){
                    this.$emit('shou',this.liwu);
                }
            }
        }
        new Vue({
            el:'#app',
            data () {
                return {
                    fromSon:{},
                }
            },
            components: {
                son,
            },
            methods: {
                mySon(val){
                    this.fromSon=val;
                }
            }
        })
    </script>
</body>
</html>